package generated1.OneToMany;

// Generated 9-apr-2009 16.17.55 by Hibernate Tools 3.2.2.GA

import java.math.BigDecimal;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

/**
 * Parent generated by hbm2java
 */
@Entity
@Table(name = "PARENT")
@SequenceGenerator(name = "Parent_seq", sequenceName = "PARENT_SEQ")
public class Parent implements java.io.Serializable {

	private BigDecimal id;
	private String nome;
	private String mail;
	private Set<Child> childs = new HashSet<Child>(0);

	public Parent() {
	}

	public Parent(BigDecimal id) {
		this.id = id;
	}

	public Parent(BigDecimal id, String nome, String mail, Set<Child> childs) {
		this.id = id;
		this.nome = nome;
		this.mail = mail;
		this.childs = childs;
	}

	@Id
	@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "Parent_seq")
	@Column(name = "ID", unique = true, nullable = false, scale = 0)
	public BigDecimal getId() {
		return this.id;
	}

	public void setId(BigDecimal id) {
		this.id = id;
	}

	@Column(name = "NOME", length = 20)
	public String getNome() {
		return this.nome;
	}

	public void setNome(String nome) {
		this.nome = nome;
	}

	@Column(name = "MAIL", length = 30)
	public String getMail() {
		return this.mail;
	}

	public void setMail(String mail) {
		this.mail = mail;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "parent")
	public Set<Child> getChilds() {
		return this.childs;
	}

	public void setChilds(Set<Child> childs) {
		this.childs = childs;
	}

}
